<template>
	<view>
		<uni-card style="padding-bottom: 20rpx;" v-for="(item,index) in monthlyDeatils" @click="toDetail(item)">
			<uni-row>
				<uni-col :span="12" >
					<view class="col-view" >{{item.className}}</view>
				</uni-col>
				<uni-col :span="12" >
					<view v-if="operationType == 'dormitory' || operationType == 'weekend'" class="col-view" >未打卡总人数:{{item.classCount}}</view>
					<view class="col-view" v-if="operationType == 'retention'">滞留总人数:{{item.classCount}}</view>
					<view class="col-view" v-if="operationType == 'morningExercises'">早操未到总人数:{{item.classCount}}</view>
					<view class="col-view" v-if="operationType == 'patrol'">白天违纪总人数:{{item.classCount}}</view>
					<view class="col-view" v-if="operationType == 'violation'">宿舍违纪总人数:{{item.classCount}}</view>
				</uni-col>
			</uni-row>
		
		</uni-card>
	</view>
</template>

<script>
	import statistics from '@/api/modules/statistics.js'
	export default {
		data() {
			return {
				monthlyDeatils: [],
				month: '',
				operationType: ''
			}
		},
		methods: {
			getStatisticalData() {
				statistics.getMonthlyDormitoryStatistics(this.userId, this.month, this.operationType).then(res => {
					uni.hideLoading()
					this.monthlyDeatils = res.data
				}).catch(e => {
					uni.hideLoading()
				})
			},
			toDetail(item) {
			
				uni.navigateTo({
					url:`/pages_duty/deptManager/statistics/dormitoryMonthlyPersonDetail?classId=${item.classId}&month=${this.month}&type=${this.operationType}`
				})
			}
		},
		onLoad(options) {
			this.userId = uni.getStorageSync("loginId");
			this.roleName = uni.getStorageSync("userRole");
			this.month = options.month;
			this.operationType = options.type
			console.log('onLoad',this.month)
			uni.showLoading({title: '加载中...'});
			this.getStatisticalData();	
		}
	}
</script>

<style>
	.col-view {
		display: flex; 
		justify-content: center;  
		align-items: center; 
		font-size: 15px; 
		font-weight: 400;
	}
</style>
